package com.vitech.javacertification.generics;

import java.util.*;

class Shape {
}

class Rect extends Shape {
}

class Circle extends Shape {
}

class ShadedRect extends Rect {
}

class GenericsPlayground {
	
	
	public static void main (String ... args){
		
		wildcards();
		
	}
	
	static void testingGenerics(String[] args) {
		List<ShadedRect> l = new LinkedList<ShadedRect>();
		add(l, 0, new ShadedRect());
	}
	
	
	static void add(List<? extends Rect> shapeList, int pos, Rect r) {
		
		List<? extends Rect> x = shapeList;
		// adding elements to shapeList will fail		
	}
	
	static void wildcards(){
				
		List<Integer> list = new ArrayList<Integer>();
		doInsert(list);				
		System.out.println(list);
		
		
		List <Number> list2 = new ArrayList<Number>();
		
		list2.add(2);
		
	}
	
	static void doInsert(List<? super Integer> list){
		
		list.add(new Integer(1));
	}

	
	
}

